package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.TradingPoolVirtualAccount;
import com.sc.nft.mapper.TradingPoolVirtualAccountMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

/**
 * @author 刘国航
 * @desc
 * @since 2024/10/29 18:15
 */
@Slf4j
@Repository
public class TradingPoolVirtualAccountDao extends ServiceImpl<TradingPoolVirtualAccountMapper, TradingPoolVirtualAccount> {

    /**
     * @param daoId
     * @return
     */
    public TradingPoolVirtualAccount getByDaoId(Long daoId) {
        LambdaQueryWrapper<TradingPoolVirtualAccount> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(TradingPoolVirtualAccount::getDaoId, daoId);
        wrapper.orderByAsc(TradingPoolVirtualAccount::getId);
        wrapper.last("limit 1");
        return baseMapper.selectOne(wrapper);
    }

}
